package com.magicode.cms.dao.impl;
import java.util.Date;

import org.springframework.stereotype.Service;

import com.magicode.cms.dao.IArticleDao;
import com.magicode.cms.entiy.base.Article;
@Service("daoarticle")
public class ArticleDaoImpl extends BaseDaoImpl<Article> implements IArticleDao {
	
	@Override
	public void deletPiclist(String userid) {
		String sql = "DELETE FROM news_pic_rela WHERE pic_id = ?";
		commonDaoService.querySql(sql,userid);
	}
	
	@Override
	public long findCountArticle(Date subDate) {
		String hql = "select count(*) FROM "+Article.class.getName()+" as t  WHERE t.subcribeTime between ? and ?";
		return (long) commonDaoService.getByHQL(hql,subDate,new Date(subDate.getTime()+24*60*60*1000));
//		String hql = "select count(*) from "+Article.class.getName()+" as t ";
//		return (long) commonDaoService.getByHQL(hql);
	}

}
